#include<iostream>
#include<cstring>
long long v[200010],w[200010];
long long l[200010],r[200010];
long long lw[200010],lv[200010];
long long y;
long long x=1;
long long mid;
using namespace std;
int main(){
    long long n,m,s;
    cin>>n>>m>>s;
    for(int i=1;i<=n;i++){
        cin>>w[i]>>v[i];
        y=max(y,w[i]);
    }
    for(int i=1;i<=m;i++){
        cin>>l[i]>>r[i];
    }
    long long answ=s;
    long long yy=0;
    y++;
    while(x<y){
        memset(lw,0,sizeof(lw));
        memset(lv,0,sizeof(lv));
        mid=(x+y)>>1;
        yy=0;
        for(int i=1;i<=n;i++){
            if(w[i]>=mid){
                lw[i]=lw[i-1]+1;
                lv[i]=lv[i-1]+v[i];
            }
           else {
            lw[i]=lw[i-1];
            lv[i]=lv[i-1];
           }
        }
        for(int i=1;i<=m;i++){
            yy+=(long long)((lw[r[i]]-lw[l[i]-1])*(lv[r[i]]-lv[l[i]-1]));
        }
        if(yy==s){
            answ=0;
            break;
        }
        answ=min(answ,abs(yy-s));
        if(yy<=s)y=mid;
        else if(yy>s)
        x=mid+1;
    }
    cout<<answ;
    return 0;
}